.class public Lcom/jecelyin/editor/v2/widget/EditorToolbar;
.super Landroidx/appcompat/widget/Toolbar;
.source "EditorToolbar.java"


# instance fields
.field private a:Landroid/graphics/Paint;

.field private b:Ljava/lang/CharSequence;

.field private c:Landroid/graphics/Paint;

.field private d:I


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .locals 0

    .line 1
    invoke-direct {p0, p1}, Landroidx/appcompat/widget/Toolbar;-><init>(Landroid/content/Context;)V

    .line 2
    invoke-direct {p0, p1}, Lcom/jecelyin/editor/v2/widget/EditorToolbar;->a(Landroid/content/Context;)V

    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
    .locals 0

    .line 3
    invoke-direct {p0, p1, p2}, Landroidx/appcompat/widget/Toolbar;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V

    .line 4
    invoke-direct {p0, p1}, Lcom/jecelyin/editor/v2/widget/EditorToolbar;->a(Landroid/content/Context;)V

    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V
    .locals 0

    .line 5
    invoke-direct {p0, p1, p2, p3}, Landroidx/appcompat/widget/Toolbar;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V

    .line 6
    invoke-direct {p0, p1}, Lcom/jecelyin/editor/v2/widget/EditorToolbar;->a(Landroid/content/Context;)V

    return-void
.end method

.method private a(Landroid/content/Context;)V
    .locals 3

    .line 1
    invoke-virtual {p0}, Landroid/view/ViewGroup;->getContext()Landroid/content/Context;

    move-result-object v0

    const/high16 v1, 0x425c0000    # 55.0f

    invoke-static {v0, v1}, Lcom/jecelyin/editor/v2/utils/h;->b(Landroid/content/Context;F)I

    move-result v0

    iput v0, p0, Lcom/jecelyin/editor/v2/widget/EditorToolbar;->d:I

    .line 2
    new-instance v0, Landroid/graphics/Paint;

    invoke-direct {v0}, Landroid/graphics/Paint;-><init>()V

    iput-object v0, p0, Lcom/jecelyin/editor/v2/widget/EditorToolbar;->a:Landroid/graphics/Paint;

    .line 3
    sget v1, Lcom/jecelyin/editor/v2/g;->je_c40_ffffff:I

    invoke-static {p1, v1}, Landroidx/core/content/ContextCompat;->getColor(Landroid/content/Context;I)I

    move-result v1

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setColor(I)V

    .line 4
    iget-object v0, p0, Lcom/jecelyin/editor/v2/widget/EditorToolbar;->a:Landroid/graphics/Paint;

    invoke-virtual {p0}, Landroid/view/ViewGroup;->getContext()Landroid/content/Context;

    move-result-object v1

    const/16 v2, 0xa

    invoke-static {v1, v2}, Lcom/jecelyin/common/utils/e;->a(Landroid/content/Context;I)I

    move-result v1

    int-to-float v1, v1

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setTextSize(F)V

    .line 5
    iget-object v0, p0, Lcom/jecelyin/editor/v2/widget/EditorToolbar;->a:Landroid/graphics/Paint;

    sget-object v1, Landroid/graphics/Paint$Align;->LEFT:Landroid/graphics/Paint$Align;

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setTextAlign(Landroid/graphics/Paint$Align;)V

    .line 6
    new-instance v0, Landroid/graphics/Paint;

    const/4 v1, 0x1

    invoke-direct {v0, v1}, Landroid/graphics/Paint;-><init>(I)V

    iput-object v0, p0, Lcom/jecelyin/editor/v2/widget/EditorToolbar;->c:Landroid/graphics/Paint;

    .line 7
    sget v1, Lcom/jecelyin/editor/v2/f;->ToolbarDividedLineColor:I

    invoke-static {p1, v1}, Lcom/jecelyin/editor/v2/utils/i;->a(Landroid/content/Context;I)I

    move-result p1

    invoke-virtual {v0, p1}, Landroid/graphics/Paint;->setColor(I)V

    .line 8
    iget-object p1, p0, Lcom/jecelyin/editor/v2/widget/EditorToolbar;->c:Landroid/graphics/Paint;

    invoke-virtual {p0}, Landroid/view/ViewGroup;->getContext()Landroid/content/Context;

    move-result-object v0

    const/high16 v1, 0x3f000000    # 0.5f

    invoke-static {v0, v1}, Lcom/jecelyin/editor/v2/utils/h;->b(Landroid/content/Context;F)I

    move-result v0

    int-to-float v0, v0

    invoke-virtual {p1, v0}, Landroid/graphics/Paint;->setStrokeWidth(F)V

    .line 9
    iget-object p1, p0, Lcom/jecelyin/editor/v2/widget/EditorToolbar;->c:Landroid/graphics/Paint;

    sget-object v0, Landroid/graphics/Paint$Align;->LEFT:Landroid/graphics/Paint$Align;

    invoke-virtual {p1, v0}, Landroid/graphics/Paint;->setTextAlign(Landroid/graphics/Paint$Align;)V

    return-void
.end method

.method private a(Landroid/graphics/Canvas;)V
    .locals 7

    .line 10
    iget v0, p0, Lcom/jecelyin/editor/v2/widget/EditorToolbar;->d:I

    int-to-float v3, v0

    invoke-virtual {p0}, Landroid/view/ViewGroup;->getWidth()I

    move-result v0

    int-to-float v4, v0

    iget v0, p0, Lcom/jecelyin/editor/v2/widget/EditorToolbar;->d:I

    int-to-float v5, v0

    iget-object v6, p0, Lcom/jecelyin/editor/v2/widget/EditorToolbar;->c:Landroid/graphics/Paint;

    const/4 v2, 0x0

    move-object v1, p1

    invoke-virtual/range {v1 .. v6}, Landroid/graphics/Canvas;->drawLine(FFFFLandroid/graphics/Paint;)V

    return-void
.end method

.method private b(Landroid/graphics/Canvas;)V
    .locals 7

    .line 1
    iget-object v1, p0, Lcom/jecelyin/editor/v2/widget/EditorToolbar;->b:Ljava/lang/CharSequence;

    invoke-interface {v1}, Ljava/lang/CharSequence;->length()I

    move-result v3

    invoke-virtual {p0}, Landroid/view/ViewGroup;->getHeight()I

    move-result v0

    add-int/lit8 v0, v0, -0xa

    int-to-float v5, v0

    iget-object v6, p0, Lcom/jecelyin/editor/v2/widget/EditorToolbar;->a:Landroid/graphics/Paint;

    const/4 v2, 0x0

    const/high16 v4, 0x42200000    # 40.0f

    move-object v0, p1

    invoke-virtual/range {v0 .. v6}, Landroid/graphics/Canvas;->drawText(Ljava/lang/CharSequence;IIFFLandroid/graphics/Paint;)V

    return-void
.end method


# virtual methods
.method public getTitle()Ljava/lang/CharSequence;
    .locals 1

    .line 1
    iget-object v0, p0, Lcom/jecelyin/editor/v2/widget/EditorToolbar;->b:Ljava/lang/CharSequence;

    return-object v0
.end method

.method protected onDraw(Landroid/graphics/Canvas;)V
    .locals 1

    .line 1
    invoke-super {p0, p1}, Landroid/view/ViewGroup;->onDraw(Landroid/graphics/Canvas;)V

    .line 2
    invoke-direct {p0, p1}, Lcom/jecelyin/editor/v2/widget/EditorToolbar;->a(Landroid/graphics/Canvas;)V

    .line 3
    iget-object v0, p0, Lcom/jecelyin/editor/v2/widget/EditorToolbar;->b:Ljava/lang/CharSequence;

    if-eqz v0, :cond_0

    .line 4
    invoke-direct {p0, p1}, Lcom/jecelyin/editor/v2/widget/EditorToolbar;->b(Landroid/graphics/Canvas;)V

    :cond_0
    return-void
.end method

.method public setTitle(I)V
    .locals 1

    .line 1
    invoke-virtual {p0}, Landroid/view/ViewGroup;->getContext()Landroid/content/Context;

    move-result-object v0

    invoke-virtual {v0, p1}, Landroid/content/Context;->getString(I)Ljava/lang/String;

    move-result-object p1

    invoke-virtual {p0, p1}, Lcom/jecelyin/editor/v2/widget/EditorToolbar;->setTitle(Ljava/lang/CharSequence;)V

    return-void
.end method

.method public setTitle(Ljava/lang/CharSequence;)V
    .locals 0

    .line 2
    iput-object p1, p0, Lcom/jecelyin/editor/v2/widget/EditorToolbar;->b:Ljava/lang/CharSequence;

    .line 3
    invoke-virtual {p0}, Landroid/view/ViewGroup;->invalidate()V

    return-void
.end method
